package com.itheima.algorithm.divideandconquer;

/**
 * <h3>数组中的第 K 个最大元素 - 分而治之</h3>
 */
public class FindKthLargestLeetcode215 {

    /*
        由大到小
        a.length = 5 -
        5   4   3   2   1
        由小到大
        0   1   2   3   4
        1   2   4   5   6

     */

    public int findKthLargest(int[] a, int k) {
        return QuickSelect.quick(a, 0, a.length - 1, a.length - k);
    }

    public static void main(String[] args) {
        FindKthLargestLeetcode215 findKthLargestLeetcode215 = new FindKthLargestLeetcode215();
        System.out.println(findKthLargestLeetcode215.findKthLargest(new int[]{1}, 1));
    }
}
